<!--
 * @Description: 工单详情
 * @Author: charles
 * @Date: 2021-12-14 22:10:42
 * @LastEditors: 石洪旭 2088649550@qq.com
 * @LastEditTime: 2025-09-26 10:52:55
-->
<template>
  <div class="details-container">
    <!-- 页面标题 -->
    <div class="page-title">工单详情</div>
    
    <!-- 详情内容直接显示在页面上 -->
    <div class="details-content">
      <el-form ref="myForm" :model="formSave" label-position="left">
        <el-row>
          <el-col :span="12">
            <el-form-item prop="id" label="工单id" :label-width="formLabelWidth">
              <el-input class="input" v-model="formSave.id" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="type" label="工单类型" :label-width="formLabelWidth">
              <el-input class="input" v-model="formSave.type" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="bill_why" label="问题叙述" :label-width="formLabelWidth">
              <el-input v-model="formSave.bill_why" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="engineer_id" label="工程师编号" :label-width="formLabelWidth">
              <el-input v-model="formSave.engineer_id" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="device_id" label="设备id" :label-width="formLabelWidth">
              <el-input v-model="formSave.device_id" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="account_id" label="账户id" :label-width="formLabelWidth">
              <el-input v-model="formSave.account_id" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="create_time" label="创建时间" :label-width="formLabelWidth">
              <el-input v-model="formSave.create_time" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="finish_time" label="完成时间" :label-width="formLabelWidth">
              <el-input v-model="formSave.finish_time" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="finish_note" label="完成备注" :label-width="formLabelWidth">
              <el-input v-model="formSave.finish_note" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="status" label="状态" :label-width="formLabelWidth">
              <el-input v-model="formSave.status" autocomplete="off" disabled>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>

    <!-- 返回按钮 -->
    <div class="back-btn">
      <el-button @click="goBack">返回列表</el-button>
    </div>
  </div>
</template>
<script>
export default {
    data() {
        return {
            formSave: {}, // 绑定表单数据
            formLabelWidth: '120px' // 表单标签宽度
        }
    },
    created() {
        // 接收路由参数并赋值给表单
        this.formSave = { ...this.$route.query }
    },
    methods: {
        // 返回列表页
        goBack() {
            this.$router.push('/order/List')
        }
    }
}
</script>
<style lang="scss" scoped>
.details-container {
  padding: 20px;
  background-color: #fff;
  min-height: 100vh;
}

.page-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.details-content {
  margin-bottom: 30px;
}

.back-btn {
  margin-top: 20px;
  text-align: right;
}

.input {
  width: 100%;
}

// 调整表单间距
::v-deep .el-form-item {
  margin-bottom: 15px;
}
</style>